#pragma once

#include <QtWidgets/QMainWindow>
#include "ui_MotionCapture.h"
#include "FbxGeneration.h"
#include "Kinect1Func.h"
#include "Kinect2Func.h"
#include "AzureKinectFunc.h"
#include "ErrorWidget.h"
#include <QValidator>
#include <QFile>
#include <QDir>
#include <QtConcurrent>

class MotionCapture : public QMainWindow
{
    Q_OBJECT

public:
    MotionCapture(QWidget *parent = Q_NULLPTR);


private:
    Ui::MotionCaptureClass ui;

    ErrorWidget * m_pErrorWin;

    int m_CapFreq;
    int m_CapTimes;
    QString m_FirstFramePath;
    QString m_SkeletonDataPath;
    QString m_FirstFramePathK2;
    QString m_SkeletonDataPathK2;
    QString m_FirstFramePathAK;
    QString m_SkeletonDataPathAK;
    QString m_FbxFilename;
    //QString m_TimeStep;
    Kinect1Func *m_pKinect1;
    Kinect2Func *m_pKinect2;
    AzureKinect *m_pAzureKinect;
    GenFbx *m_pgenfbx;
    QFutureWatcher<void> *m_pwatcher;
    QFuture<int> m_future;

    bool removeFolderContent(const QString &folderDir);
    int generateFbx();
    QString saveCaptureInfo();
    void ApplySetting();

public slots:

    void on_BStartCam_clicked();
    void on_BStopCam_clicked();
    void on_BStartGenerating_clicked();
    void on_BOpenFile_clicked();
    void on_finished();
};
